﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/SiteMaster.Master"
    Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<%@ Import Namespace="Microhard.Framework.MVCHelper" %>
<%@ Import Namespace="Microhard.WarehouseInsp.WebUI.Models" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    仓库管理
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div class="section-header">
        <div class="title">
            <img src="<%=Url.Content("~/Content/images/ico-catalog.png")%>" alt="" />
            仓库管理
        </div>
        <div class="options">
        </div>
    </div>
    <p>
    </p>
    <table class="adminContent">
        <tr>
            <td>
                <%Html.Telerik().Grid<Microhard.WarehouseInsp.Buz.Models.WarehouseModel>((List<Microhard.WarehouseInsp.Buz.Models.WarehouseModel>)this.Model.Data)
                    .Name("operation-grid")
                    .ToolBar(t => t.Template(g =>
                    { %>
                <div class="header-menu">
                    <ul class="t-widget t-reset t-header t-menu">
                        <li class="t-item  t-state-default">
                            <%=Html.Authorized_AddButton("btnAdd", "添加", "Create", "Warehouse")%>
                        </li>
                        <li class="t-item  t-state-default">
                            <%=Html.Authorized_UpdateButton("btnUpdate", "修改", "operation-grid", "Update", "Warehouse", "WarehouseInsp")%>
                        </li>
                        <li class="t-item  t-state-default">
                            <%=Html.Authorized_DeleteButton("btnDelete", "删除", "operation-grid", "Delete", "Warehouse", "WarehouseInsp")%>
                        </li>
                    </ul>
                </div>
                <%}))
                         .Columns(columns =>
                    {
                        columns.Bound(x => x.WarehouseID)
                       .Template(x => Html.CheckBox("checkedRecords", new { value = x.WarehouseID, @class = "gridCks" }))
                       .ClientTemplate("<input type='checkbox' name='checkedRecords' value='<#= WarehouseID #>' class='gridCks'/>")
                     .HtmlAttributes(new { style = "text-align:center" }).Title("选择");

                                                columns.Template(x => {%>
                <a href="#" onclick="winViewWHDetail_ShowDetail(this)" id="<%=x.WarehouseID%>">
                    <%=x.Name %></a>
                <% }).ClientTemplate("<a href='#' id='<#=WarehouseID#>' onclick='winViewWHDetail_ShowDetail(this)'><#=Name #></a>").Title("仓库名称");
                                                columns.Bound(x => x.WarehouseMngName).Title("监管员");
                                                columns.Bound(x => x.Address).Title("地址");
                                                columns.Bound(x => x.Area).Title("面积(平方米)");
                                                columns.Bound(x => x.RentRange).Title("租期(月)");
                                                columns.Bound(x => x.ClacType).Title("计量方式");
                                                columns.Bound(x => x.WarehouseType).Title("类型");
                                                columns.Bound(x => x.CheckType).Title("盘货方式");
                                                columns.Bound(x => x.WorkCondition).Title("办公条件");
                                                columns.Bound(x => x.LiveCondition).Title("住宿安排");
                                                columns.Bound(x => x.EatCondition).Title("用餐情况");

                    })
                      .Pageable(settings => settings.Total(Model.Total).PageSize(Html.GetGridPageSize()).Position(GridPagerPosition.Top))
                     .DataBinding(dataBinding => dataBinding.Ajax().Select("_List", "Warehouse"))
                      .EnableCustomBinding(true)
                    .Render();
                %>
            </td>
        </tr>
    </table>
    <%Html.RenderPartial("ViewDetailCtr", new Microhard.WarehouseInsp.WebUI.Models.ViewDetailCtrModel
      {
          ActionName = "_AjaxViewDetail",
          AreaName = "WarehouseInsp",
          ControllerName = "Warehouse",
          CtrID = "winViewWHDetail",
          WinWidth = 900,
          WinHeight = 600
      }); %>
    <script type="text/javascript">
        function showfileLinks(e) {
            var all = "";
            var baseUrl = '<%=Url.Action("Download","Upload")%>';
            for (var f = 0; f < e.length; f++) {
                var url = baseUrl + "?fileid=" + e[f].AttachmentID;
                all = all + '<a href="' + url + '">' + e[f].Name + "</a></br>";
            }
            return all;
        }
    </script>
</asp:Content>
